package shuzu;

import java.util.Arrays;
import java.util.Scanner;

public class ShuZu_JiOu {
    public static void main(String[] args) {
        Scanner scanner =new Scanner(System.in);
        System.out.println("请输入数组长度：");
        int arrlen = scanner.nextInt();
        int[] arr = new int[arrlen];
        System.out.println("请输入数组的每一个元素：");
        for (int i = 0;i < arr.length;i++) {
            arr[i] = scanner.nextInt();
        }

        for (int j = 0;j < arr.length - 1;j++) {
            for (int i = 0;i < arr.length - 1 - j;i++) {
                int temp = 0;
                if (arr[i] % 2 == 0 && arr[i + 1] % 2 == 1) {
                    temp = arr[i + 1];
                    arr[i + 1] = arr[i];
                    arr[i] = temp;
                }
            }
        }
        System.out.println(Arrays.toString(arr));
    }
}
